﻿using MCPlatform.MotionLib.Base.Models;

namespace MCPlatform.MotionLib.Base
{
    public interface IImputation
    {
        public string ControlName { get; set; }
        double ActualVelocity { get; }
        ImpMotionParaModel ImputationConfig { get; set; }
        public bool IsImpDone { get; set; }

        public bool IsImpBusy { get; set; }

        public bool IsImpIdle { get; set; }

        public bool IsImpPasue { get; set; }

        public bool IsImpError { get; set; }

        public bool IsImpGear { get; set; }

        public double XAxiPos { get; set; }
        public double YAxiPos { get; set; }
        public double ZAxiPos { get; set; }

        public double UAxiPos { get; set; }
        public double VAxiPos { get; set; }
        public double WAxiPos { get; set; }

        public short Reset();

        public short SetVelocity(double velocity);

        short ContiAxisAbsMove(ushort axis, double dist, ushort mode, int mark);
        short ContiAxisRelMove(ushort axis, double dist, ushort mode, int mark);
        short ContiChangeSpeedRatio(double percent);
        short ContiCloseList();
        short ContiGetLookaheadMode(ref ushort enable, ref int lookAheadSegments, ref double pathError, ref double lookaheadAcc);
        short ContiImpArc3PointAbsMove(double[] targetPos, double[] midPos, int circle, int mark);
        short ContiImpArc3PointRelMove(double[] targetPos, double[] midPos, int circle, int mark);
        short ContiImpArcCenterAbsMove(double[] targetPos, double[] centerPos, ushort arcDir, int circle, int mark);
        short ContiImpArcCenterRelMove(double[] targetPos, double[] centerPos, ushort arcDir, int circle, int mark);
        short ContiImpArcRediusAbsMove(double[] targetPos, double arcRadius, ushort arcDir, int circle, int mark);
        short ContiImpArcRediusRelMove(double[] targetPos, double arcRadius, ushort arcDir, int circle, int mark);
        short ContiImpLineAbsMove(double[] targetPos, int mark);
        short ContiImpLineRelMove(double[] targetPos, int mark);
        short ContiImpRectangleAbsMove(double[] targetPos, double[] markPos, int count, ushort recMode, int mark);
        short ContiImpRectangleRelMove(double[] targetPos, double[] markPos, int count, ushort recMode, int mark);
        short ContiOpenList();
        short ContiPauseAfterAxisMoveRetPausePos(ushort axis);
        short ContiPauseAndAxisAbsMove(ushort axis, double targetPos, double minVel, double maxVel, double stopVel, double acc, double dec, double smoothTime);
        short ContiPauseAndAxisRelMove(ushort axis, double targetPos, double minVel, double maxVel, double stopVel, double acc, double dec, double smoothTime);
        short ContiPauseList();
        short ContiPauseListDelay(double delayTime, int mark);
        int ContiReadCurrentMark();
        int ContiRemainSpace();
        short ContiSetLookaheadMode(ushort enable, int lookAheadSegments, double pathError, double lookaheadAcc);
        short ContiStartList();
        short ContiStopList(ushort stopMode = 0);
        short GetImpProfile(ref double minVelocity, ref double maxVelocity, ref double acc, ref double dec, ref double stopVelocity);
        short GetImpSProfile(ref double s_para, ushort s_mode = 0);
        short GetMulticoorCurrentVeocity(ref double vel);
        short GetMulticoorRunState();
        short GetTangentFollow(ref ushort axisNo, ref ushort followCurve, ref ushort rotDir, ref double degreeEquiv);
        short ImpArc3PointAbsMove(double[] targetPos, double[] midPos, int circle = 0);
        short ImpArc3PointRelMove(double[] targetPos, double[] midPos, int circle = 0);
        short ImpArcCenterAbsMove(double[] targetPos, double[] centerPos, ushort arcDir = 1, int circle = 0);
        short ImpArcCenterRelMove(double[] targetPos, double[] centerPos, ushort arcDir = 1, int circle = 0);
        short ImpArcRediusAbsMove(double[] targetPos, double arcRadius, ushort arcDir = 1, int circle = 0);
        short ImpArcRediusRelMove(double[] targetPos, double arcRadius, ushort arcDir = 1, int circle = 0);
        short ImpEllipseAbsMove(double[] targetPos, double[] centerPos, double aAxisLen, double bAxisLen, ushort dir);
        short ImpEllipseRelMove(double[] targetPos, double[] centerPos, double aAxisLen, double bAxisLen, ushort dir);
        short ImpEnableLineMoveAxisNum(ushort enableNum);
        short ImpLineAbsMove(double[] targetPos);
        short ImpLineRelMove(double[] targetPos);

        Task<(bool, short, string)> ImpLineAbsMoveAsync(double[] targetPos, CancellationToken cancellationToken, ManualResetEvent manualResetEvent);
        Task<(bool, short, string)> ImpLineRelMoveAsync(double[] targetPos, CancellationToken cancellationToken, ManualResetEvent manualResetEvent);
        short ImpRectangleAbsMove(double[] targetPos, double[] markPos, int count, ushort recMode);
        short ImpRectangleRelMove(double[] targetPos, double[] markPos, int count, ushort recMode);
        short SetImpProfile();
        short SetImpSProfile();
        short SetTangentFollow(ushort axisNo, ushort followCurve, ushort rotDir, double degreeEquiv);
        short StopMulticoor();

        short ContiGearPos(ushort axisId, double dist, int mark);

        short ContiGearVelocity(ushort axisId, double dist, int mark);

        Task<(bool, short, string)> ContiImpLineAbsMoveAsync(double[] targetPos, int mark,CancellationToken cancellationToken, ManualResetEvent manualResetEvent);

        Task<(bool, short, string)> ContiImpLineRelMoveAsync(double[] targetPos, int mark, CancellationToken cancellationToken, ManualResetEvent manualResetEvent);



    }
}